// 图谱工作流相关接口
import axios from '../interceptors.js'

// 查询图谱任务列表
export const getPipeline = (data) => {
  return axios({
    url: '/pipeline/pipelines',
    method: 'get',
    params: data
  })
}

// 图谱查询日志
export const getLogs = (data) => {
  return axios({
    url: '/pipeline/pipelines/logs/' + data.id,
    method: 'get'
  })
}

// // 图谱这个任务的各个工作流列表
export const pipelineJobs = (data) => {
  return axios({
    url: '/pipeline/pipelines/pipeline-jobs/',
    method: 'get',
    params: data
  })
}

// 新增图谱工作流
export const addPipeline = (data) => {
  return axios({
    url: '/pipeline/pipelines',
    method: 'post',
    data
  })
}

// 删除图谱工作流
export const delPipeline = (data) => {
  return axios({
    url: '/pipeline/pipelines/' + data.id,
    method: 'delete'
  })
}

// 编辑图谱工作流
export const editPipeline = (data) => {
  return axios({
    url: '/pipeline/pipelines',
    method: 'put',
    data
  })
}
// 查询图谱名称
export const getAtlaName = (data) => {
  return axios({
    url: '/pipeline/instance/get/' + data.id,
    method: 'get'
  })
}

// 复制工作流
export const copy = (data) => {
  return axios({
    url: '/pipeline/pipelines/copy/' + data.id,
    method: 'get'
  })
}

// 启动工作流
export const runPipeline = (data) => {
  return axios({
    url: '/pipeline/pipelines/pipeline-jobs',
    method: 'post'
  })
};

// 暂停工作流
export const stopPipeline = (data) => {
  return axios({
    url: `/pipeline/pipelines/stop/${data.id}`
  })
};
